# $ANTLR 3.1.1 simple_pyexpression.g 2009-01-14 21:19:20

import sys
from antlr3 import *
from antlr3.compat import set, frozenset


# for convenience in actions
HIDDEN = BaseRecognizer.HIDDEN

# token types
WS=6
NEWLINE=4
T__12=12
T__11=11
T__10=10
INT=5
EOF=-1
T__9=9
T__8=8
T__7=7


class simple_pyexpressionLexer(Lexer):

    grammarFileName = "simple_pyexpression.g"
    antlr_version = version_str_to_tuple("3.1.1")
    antlr_version_str = "3.1.1"

    def __init__(self, input=None, state=None):
        if state is None:
            state = RecognizerSharedState()
        Lexer.__init__(self, input, state)






    # $ANTLR start "T__7"
    def mT__7(self, ):

        try:
            _type = T__7
            _channel = DEFAULT_CHANNEL

            # simple_pyexpression.g:7:6: ( '+' )
            # simple_pyexpression.g:7:8: '+'
            pass 
            self.match(43)



            self._state.type = _type
            self._state.channel = _channel

        finally:

            pass

    # $ANTLR end "T__7"



    # $ANTLR start "T__8"
    def mT__8(self, ):

        try:
            _type = T__8
            _channel = DEFAULT_CHANNEL

            # simple_pyexpression.g:8:6: ( '-' )
            # simple_pyexpression.g:8:8: '-'
            pass 
            self.match(45)



            self._state.type = _type
            self._state.channel = _channel

        finally:

            pass

    # $ANTLR end "T__8"



    # $ANTLR start "T__9"
    def mT__9(self, ):

        try:
            _type = T__9
            _channel = DEFAULT_CHANNEL

            # simple_pyexpression.g:9:6: ( '*' )
            # simple_pyexpression.g:9:8: '*'
            pass 
            self.match(42)



            self._state.type = _type
            self._state.channel = _channel

        finally:

            pass

    # $ANTLR end "T__9"



    # $ANTLR start "T__10"
    def mT__10(self, ):

        try:
            _type = T__10
            _channel = DEFAULT_CHANNEL

            # simple_pyexpression.g:10:7: ( '/' )
            # simple_pyexpression.g:10:9: '/'
            pass 
            self.match(47)



            self._state.type = _type
            self._state.channel = _channel

        finally:

            pass

    # $ANTLR end "T__10"



    # $ANTLR start "T__11"
    def mT__11(self, ):

        try:
            _type = T__11
            _channel = DEFAULT_CHANNEL

            # simple_pyexpression.g:11:7: ( '(' )
            # simple_pyexpression.g:11:9: '('
            pass 
            self.match(40)



            self._state.type = _type
            self._state.channel = _channel

        finally:

            pass

    # $ANTLR end "T__11"



    # $ANTLR start "T__12"
    def mT__12(self, ):

        try:
            _type = T__12
            _channel = DEFAULT_CHANNEL

            # simple_pyexpression.g:12:7: ( ')' )
            # simple_pyexpression.g:12:9: ')'
            pass 
            self.match(41)



            self._state.type = _type
            self._state.channel = _channel

        finally:

            pass

    # $ANTLR end "T__12"



    # $ANTLR start "INT"
    def mINT(self, ):

        try:
            _type = INT
            _channel = DEFAULT_CHANNEL

            # simple_pyexpression.g:21:5: ( ( '0' .. '9' )+ )
            # simple_pyexpression.g:21:9: ( '0' .. '9' )+
            pass 
            # simple_pyexpression.g:21:9: ( '0' .. '9' )+
            cnt1 = 0
            while True: #loop1
                alt1 = 2
                LA1_0 = self.input.LA(1)

                if ((48 <= LA1_0 <= 57)) :
                    alt1 = 1


                if alt1 == 1:
                    # simple_pyexpression.g:21:9: '0' .. '9'
                    pass 
                    self.matchRange(48, 57)


                else:
                    if cnt1 >= 1:
                        break #loop1

                    eee = EarlyExitException(1, self.input)
                    raise eee

                cnt1 += 1





            self._state.type = _type
            self._state.channel = _channel

        finally:

            pass

    # $ANTLR end "INT"



    # $ANTLR start "NEWLINE"
    def mNEWLINE(self, ):

        try:
            _type = NEWLINE
            _channel = DEFAULT_CHANNEL

            # simple_pyexpression.g:22:8: ( ( '\\r' )? '\\n' )
            # simple_pyexpression.g:22:9: ( '\\r' )? '\\n'
            pass 
            # simple_pyexpression.g:22:9: ( '\\r' )?
            alt2 = 2
            LA2_0 = self.input.LA(1)

            if (LA2_0 == 13) :
                alt2 = 1
            if alt2 == 1:
                # simple_pyexpression.g:22:9: '\\r'
                pass 
                self.match(13)



            self.match(10)



            self._state.type = _type
            self._state.channel = _channel

        finally:

            pass

    # $ANTLR end "NEWLINE"



    # $ANTLR start "WS"
    def mWS(self, ):

        try:
            _type = WS
            _channel = DEFAULT_CHANNEL

            # simple_pyexpression.g:23:5: ( ( ' ' | '\\t' )+ )
            # simple_pyexpression.g:23:9: ( ' ' | '\\t' )+
            pass 
            # simple_pyexpression.g:23:9: ( ' ' | '\\t' )+
            cnt3 = 0
            while True: #loop3
                alt3 = 2
                LA3_0 = self.input.LA(1)

                if (LA3_0 == 9 or LA3_0 == 32) :
                    alt3 = 1


                if alt3 == 1:
                    # simple_pyexpression.g:
                    pass 
                    if self.input.LA(1) == 9 or self.input.LA(1) == 32:
                        self.input.consume()
                    else:
                        mse = MismatchedSetException(None, self.input)
                        self.recover(mse)
                        raise mse



                else:
                    if cnt3 >= 1:
                        break #loop3

                    eee = EarlyExitException(3, self.input)
                    raise eee

                cnt3 += 1





            self._state.type = _type
            self._state.channel = _channel

        finally:

            pass

    # $ANTLR end "WS"



    def mTokens(self):
        # simple_pyexpression.g:1:8: ( T__7 | T__8 | T__9 | T__10 | T__11 | T__12 | INT | NEWLINE | WS )
        alt4 = 9
        LA4 = self.input.LA(1)
        if LA4 == 43:
            alt4 = 1
        elif LA4 == 45:
            alt4 = 2
        elif LA4 == 42:
            alt4 = 3
        elif LA4 == 47:
            alt4 = 4
        elif LA4 == 40:
            alt4 = 5
        elif LA4 == 41:
            alt4 = 6
        elif LA4 == 48 or LA4 == 49 or LA4 == 50 or LA4 == 51 or LA4 == 52 or LA4 == 53 or LA4 == 54 or LA4 == 55 or LA4 == 56 or LA4 == 57:
            alt4 = 7
        elif LA4 == 10 or LA4 == 13:
            alt4 = 8
        elif LA4 == 9 or LA4 == 32:
            alt4 = 9
        else:
            nvae = NoViableAltException("", 4, 0, self.input)

            raise nvae

        if alt4 == 1:
            # simple_pyexpression.g:1:10: T__7
            pass 
            self.mT__7()


        elif alt4 == 2:
            # simple_pyexpression.g:1:15: T__8
            pass 
            self.mT__8()


        elif alt4 == 3:
            # simple_pyexpression.g:1:20: T__9
            pass 
            self.mT__9()


        elif alt4 == 4:
            # simple_pyexpression.g:1:25: T__10
            pass 
            self.mT__10()


        elif alt4 == 5:
            # simple_pyexpression.g:1:31: T__11
            pass 
            self.mT__11()


        elif alt4 == 6:
            # simple_pyexpression.g:1:37: T__12
            pass 
            self.mT__12()


        elif alt4 == 7:
            # simple_pyexpression.g:1:43: INT
            pass 
            self.mINT()


        elif alt4 == 8:
            # simple_pyexpression.g:1:47: NEWLINE
            pass 
            self.mNEWLINE()


        elif alt4 == 9:
            # simple_pyexpression.g:1:55: WS
            pass 
            self.mWS()







 



def main(argv, stdin=sys.stdin, stdout=sys.stdout, stderr=sys.stderr):
    from antlr3.main import LexerMain
    main = LexerMain(simple_pyexpressionLexer)
    main.stdin = stdin
    main.stdout = stdout
    main.stderr = stderr
    main.execute(argv)


if __name__ == '__main__':
    main(sys.argv)
